package com.link.base.base.signin.service;

import com.link.base.base.signin.dao.mybatis.mapper.SignInDetailsMapper;
import com.link.base.base.signin.model.SignInDetails;
import com.link.core.basic.dao.mapper.BasicMapper;
import com.link.core.basic.service.ServiceException;
import com.link.core.basic.service.BasicServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author unknown
 * @date unknown
 * @comments 签到明细
 */
@Service
public class SignInDetailsServiceImpl extends BasicServiceImpl<SignInDetails> implements SignInDetailsService {

    @Resource
    private SignInDetailsMapper signInDetailsMapper;

    @Override
    public BasicMapper<SignInDetails> getBasicMapper() {
        return signInDetailsMapper;
    }

    @Override
    public int queryCountByHeadId(Long signInId) throws Exception {
        if (null == signInId) {
            throw new ServiceException("SIGNIN-001");
        }
        SignInDetails entity = new SignInDetails();
        entity.setHeadId(signInId);
        return signInDetailsMapper.queryCountByHeadId(entity);
    }
}
